﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace work2
{
    class Book
    {
        //     定义一个图书类，存放图书的编号、书名、价格、出版社、作者信息；
        //对价格进行赋值限制，小于0价格，赋值为0
        //在图书类中定义一个方法输出图书信息；
        //在主方法实例化对象，赋值并输出
        public int bookid;
        public string bookname;
        private int bookprice;
        public string bookpub;
        public string author;
        public int Bookprice
        {
            get{
                return bookprice;
            }
            set
            {
                if (value >0)
                {
                    bookprice = value;
                }
            }
        }
        public void Print (){
            Console.WriteLine("书籍编号："+this.bookid);
            Console.WriteLine("书籍名称：" + this.bookname) ;
            Console.WriteLine("价格：" + this.bookprice);
            Console.WriteLine("作者：" + this.author);
        }
    }
}
